package hadoopLearn.Else;

import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.TaskAttemptContext;

import java.io.IOException;
import java.io.PrintWriter;

public class CourseRecordWriter extends RecordWriter<Text, IntWritable> {
    private PrintWriter out;
    public CourseRecordWriter(FSDataOutputStream course){
        out = new PrintWriter(course);
    }
    public CourseRecordWriter(){
        return;
    }

    public void write(Text key, IntWritable value)
        throws IOException, InterruptedException
    {
        out.println(key + "\t" + value);
    }
    public void close(TaskAttemptContext arg0) throws IOException, InterruptedException{
        out.close();
    }
}
